import axiosInstance from '@/api/axiosInstance'
interface regularShareRuleListParams {
  name?: string
  // 其他查询条件...
}

// 获取常规销售分成规则列表
export const getRegularShareRuleList = async (params?: regularShareRuleListParams) => {
  return axiosInstance.get('/admin/regular-share-rule', { params })
}

// 获取常规销售分成规则详情
export const getRegularShareRuleDetail = async (id: number) => {
  return axiosInstance.get(`/admin/regular-share-rule/${id}`)
}
// 创建常规销售分成规则
export const createRegularShareRule = async (data: any) => {
  return axiosInstance.post('/admin/regular-share-rule', data)
}

// 更新常规销售分成规则
export const updateRegularShareRule = async (id: number, data: any) => {
  return axiosInstance.put(`/admin/regular-share-rule/${id}`, data)
}

// 删除常规销售分成规则
export const deleteRegularShareRule = async (id: number) => {
  return axiosInstance.delete(`/admin/regular-share-rule/${id}`)
}

//创建规则项
export const createRegularShareRuleItem = async (id: number, data: any) => {
  return axiosInstance.post(`/admin/regular-share-rule/${id}/item`, data)
}

//更新规则项
export const updateRegularShareRuleItem = async (id: number, itemId: number, data: any) => {
  return axiosInstance.put(`/admin/regular-share-rule/${id}/item/${itemId}`, data)
}

//删除规则项
export const deleteRegularShareRuleItem = async (id: number, itemId: number) => {
  return axiosInstance.delete(`/admin/regular-share-rule/${id}/item/${itemId}`)
}


// 设置适配该规则的医师
export const setRegularShareRuleDoctor = async (id: number, data: any) => {
  return axiosInstance.post(`/admin/regular-share-rule/${id}/applicable-doctors`, data)
}